ISRO CSE 2018


Q2.

Consider the following program{ int x=1; printf("%d",(*char(char*)&x)); } Assuming required header files are included and if the machine in which this program is executed is little endian, then the output will be
GateOverflow

Q3.

Consider the following declaration : structaddr { char city[10]; char street[30]; int pin; }; struct { char name[30]; int gender; struct addr locate; } person, *kd = &personThen ^{\star}(k d->\text { name }+2) can be used instead of:
GateOverflow

Q4.

An array A consists of n integers in locations A[0],A[1],...A[n-1]. It is required to shift the elements of the array cyclically to the left by k places, where 1 \leq k \leq (n-1). An incomplete algorithm for doing this in linear time, without using another array is given bellow. Complete the algorithm by filling in the blanks. min=n; i=0; while(_________) { temp= A[i]; j=i; while(_________) { A[j]= _______; j=(j+k) mod n; if(j < min) then min = j; } A[(n+i-k) mod n]=_______; i=________; }
GateOverflow

Q5.

For a multi-processor architecture, in which protocol a write transaction is forwarded to only those processors that are known to possess a copy of newly altered cache line?
GateOverflow

Q6.

The domain of the function \log (\log \sin (x)) is:
GateOverflow

Q7.

Consider the following C code segment: #include < stdio.h > main() { int i, j, x; scanf("%d", &x); i=1; j=1; while (i<10) { j =j*i; i= i+1; if(i==x) break; } }For the program fragment above, which of the following statements about the variables i and j must be true after execution of this program? [ !(exclamation) sign denotes factorial in the answer]
GateOverflow

Q8.

Consider the following C program: main() { float sum= 0.0, j=1.0,i=2.0; while(i/j>0.001){ j=j+1; sum=sum+i/j; printf("%f/n", sum); } }
GateOverflow

Q9.

Which traversals of Tree-1 and Tree-2, respectively, will produce the same sequence?
GateOverflow

Q10.

A CFG (Context Free Grammar) is said to be in Chomsky Normal Form (CNF), if all the productions are of the form \mathrm{A} \rightarrow \mathrm{BC} or \mathrm{A} \rightarrow \mathrm{a}. Let G be a CFG in CNF. To derive a string of terminals of length x, the number of products to be used is:
GateOverflow